package com.xjcs.saplingplan.dialog

import android.content.Context
import com.lxj.xpopup.core.AttachPopupView
import com.xjcs.saplingplan.R
import com.xjcs.saplingplan.const.setSingleClick
import com.xjcs.saplingplan.databinding.PopCountdownTypeBinding

class CountdownTypePop(
    context: Context,
    private val callback: (type: Int) -> Unit
): AttachPopupView(context) {

    private lateinit var binding: PopCountdownTypeBinding

    override fun getImplLayoutId(): Int {
        return R.layout.pop_countdown_type
    }

    override fun onCreate() {
        super.onCreate()
        binding = PopCountdownTypeBinding.bind(attachPopupContainer.getChildAt(0))
        binding.linearCountdown.setSingleClick {
            callback.invoke(0)
            dismiss()
        }
        binding.linearMemorial.setSingleClick {
            callback.invoke(1)
            dismiss()
        }
        binding.linearBirth.setSingleClick {
            callback.invoke(2)
            dismiss()
        }
        binding.linearFes.setSingleClick {
            callback.invoke(3)
            dismiss()
        }
    }

}